package cfca.paperless.client.servlet._3_assist._3_08_GetSealApplyInfo;

import cfca.paperless.client.servlet.PaperlessClient;
import cfca.paperless.client.servlet.PaperlessConfig;
import cfca.paperless.client.util.StringUtil;

/**
 * @Description
 * @Author dell
 * @Date 2016-5-13
 * @CodeReviewer TODO
 */
public class GetSealApplyInfoTest01 {

    public static void main(String[] args) throws Exception {
        try {
            PaperlessClient clientBean = new PaperlessClient(PaperlessConfig.assistUrl, 10000, 60000);// 无纸化辅助接口的访问URL

            // 操作员编码或者机构号
            String operatorCode = PaperlessConfig.operatorCode;

            String sealCode = "yz201804847655019";
            String requestXml = "<Request>" 
                                + "<SealCode>" + sealCode + "</SealCode>"
                                + "<UserName>" + "苏才礼" + "</UserName>" 
                                + "<IdentificationType>" + "Z" + "</IdentificationType>"
                                + "<IdentificationNo>" + sealCode + "</IdentificationNo>"
                              + "</Request>";
            // 新增只有SealOrg和SealPerson的情况
//            String requestXml = "<Request>" 
//                                    + "<SealOrg>" + "客户机构1" + "</SealOrg>"
//                                    + "<SealPerson>" + "张三" + "</SealPerson>"
//                                  + "</Request>";
            String result = clientBean.getSealApplyInfo(requestXml, "gy001");

            String code = StringUtil.getNodeText(result, "Code");
            if (!code.equals("200")) {
                System.out.println("getSealApplyInfo");
                System.out.println(result);
            } else {
//                System.out.println(result);
                String sealApplyInfoXml = StringUtil.getNodeText(result, "SealApplyInfoXml");
                String sealPassword = StringUtil.getNodeText(sealApplyInfoXml, "SealPassword");
                
                System.out.println("SealApplyInfoXml:" + sealApplyInfoXml);
                System.out.println("sealPassword:" + sealPassword);

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
